    @extends('template/master')	
	@section('pageTitle')
		{{ Lang::get('label.homePageTitle')}}
	@stop
	
	@section('content')
	 <style>
        #slide {
            width: 700px;
            height: 200px;
			float:left;			
					
        }
        #slide li{
        	
        	height: 257px !important;
        	padding-left:5px;
        }
            
        @media only screen and (max-width: 448px) {
            #slide {
                width: 376px;
                height: 252px;
            }
        }
        
        @media only screen and (max-width: 388px) {
            #slide {
                width: 216px;
                height: auto;
            }
        }
        
        #slide img {
            max-width: 100%;
            height: auto;
        }
		#slide-pager{
			float:left;
			position:relative;
			top:10px;
			z-index:5000;
			left:69%;
		}
        </style>
	<script type="text/javascript">
            $(function() {						
                $('#slide').ulslide({
                    width: 700,
                    height: 150,
                    canResize: true,
					duration: 400,
					effect: {
						//type: 'flip3D', // slide or fade
						type: 'rotate'
						
					},
					 nextButton: '#slide_next',
                    prevButton: '#slide_prev',
					 autoslide: 3000,
                    pager: '#slide-pager a'
                });
            });
        </script>
 <!-- Including Mousewheel jQuery plugin (optional) -->
        <script type="text/javascript" src="<?php echo $jsPath; ?>/jquery.mousewheel.js"></script>
		
        <!-- Including ulslide jQuery plugin (required) -->
        <script type="text/javascript" src="<?php echo $jsPath; ?>/jquery.ulslide.js"></script>

		<!-- Demo styles (optional) -->
		<link rel='stylesheet' href='<?php echo $cssPath; ?>/style.css' type='text/css' media='all' />

    <!-- Page Content -->
    <div class="container">

        <div class="row">

            <!-- column7 -->
            <div class="col-md-7">	
					<!-- Slider -->
					<h1 class="title"><?php echo Lang::get('label.topStory'); ?></h1>
					<div style="background: #e5e5e1;clear: both;overflow: hidden;">					
						<?php if(count($topStory)>0){?>
						<ul id="slide">
						<?php foreach ($topStory as $story){?>
			            <li>
			               <a href="{{ SEO::generateNewsURL($story->id,$story->title)}} "> <img src="<?php echo "../".$story->featurePhoto;?>" alt="" style="width:60%;float:left;margin-right:5px; margin-top:5px" /></a>
							<div style="width:32%;float:left">
								<h3 style="width:99%;float:left;clear:both">
									<a href=" {{ SEO::generateNewsURL($story->id,$story->title)}} ">{{ $story->title }}</a>
								</h3>
								<div>{{ $story->descriptions }}</div>
							</div>
			            </li>
			            <?php }?>
			           
			        </ul>
			        <ul id="slide-pager">
						<li><span href="#" id="slide_prev"><i class="glyphicon glyphicon-chevron-left"></i></span></li>
						<?php for($i=1;$i<= count($topStory);$i++){?>
						<li><a href="#{{$i}}">{{ $i }}</a></li>
						<?php }?>
						<li><span href="#" id="slide_next"><i class="glyphicon glyphicon-chevron-right"></i></span></li>
					</ul>
					<?php } ?>
					</div>
					<!-- Latest Post-->
					<h1 class="title"><?php echo Lang::get('label.latestNews'); ?></h1>
					<?php foreach( $latestNews as $value ) : $linkTo = SEO::generateNewsURL($value->id,$value->title);
						?>
                    	<div class="col-md-6 col-lg-6 col-xs-12 col-sm-12 clear-padding">
							<h2 class="title2"><a href="{{ $linkTo }}"><?= $value->title;?></a></h2>
							<?php if( !empty($value->featurePhoto) ) : ?>
							<div class="col-xs-12 col-sm-12 col-md-5 col-lg-4 clear-padding" style="padding-right:15px;padding-top:5px;"><a href="{{ $linkTo }}"><img src="<?php echo "../".$value->featurePhoto; ?>" class="img-responsive" width="107" height="76"></a></div>
							<div class="col-xs-12 col-sm-12 col-md-7 col-lg-8 clear-padding" style="padding-right:15px;"><a href="{{ $linkTo }}" class="news-style">{{Str::limit($value->descriptions, Options::PAGE_HOME_LATEST_NEWS_DESC_WITH_IMG_CHAR) }}</a><br><span class="time-date">
							<?php else : ?>							
							<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 clear-padding" style="padding-right:15px;"><a href="{{ $linkTo }}" class="news-style">{{Str::limit($value->descriptions, Options::PAGE_HOME_LATEST_NEWS_DESC_WITHOUT_IMG_CHAR) }}</a><br><span class="time-date">
							<?php endif; ?>
														
							{{ date(Options::DATE_TIME_FORMAT,strtotime($value->created_at)) }}</span></div>
						</div><!-- / column6-->
                    <?php endforeach; ?> 	

            </div><!-- / column7-->
            
            <!-- Sidebar -->
            <div class="col-md-5 col-sm-12 col-xs-12">

        	<div class="clearfix"></div>

               <h1 class="title"><?php echo Lang::get('label.mostViewed'); ?></h1>
                    <div class="row">
                        <div class="col-lg-12">
                            <ul class="list-styled">
                            <?php foreach( $mostViewed as $value ) : $linkTo = SEO::generateNewsURL($value->id,$value->title); ?>
                            	<li><a href="{{ $linkTo }}" class="news-style"><?= $value->title;?></a></li>
                            <?php endforeach; ?> 
                            </ul>
                        </div>
                        <!-- /.col-lg-6 -->
                    </div>
                    <!-- /.row -->

 				<h1 class="title"><?php echo Lang::get('label.mostCommented'); ?></h1>
                    <div class="row">
                        <div class="col-lg-12">
                            <ul class="list-styled">
                            <?php foreach( $mostCommented as $value ) : $linkTo = SEO::generateNewsURL($value->id,$value->title); ?>
                            	<li><a href="{{ $linkTo }}" class="news-style"><?= $value->title;?></a></li>
                            <?php endforeach; ?>
                            </ul>
                        </div>
                        <!-- /.col-lg-6 -->
                    </div>
                    <!-- /.row -->      
            </div>  <!-- /.col-md-5-->
        </div> <!-- /.row -->
				<div class="row">
				
				<?php foreach( $catNews as $key=>$news ) : ?>
					<?php if( !empty($news[0]) ) : ?>
					<div class="clearfix"></div>
					<h1 class="title"  style="margin-left:15px; " ><?=$key;?></h1>
					<div class="col-md-12 col-lg-12 clear-padding">					
					<?php $switch = false; 	for( $i=0; $i<count($news); $i=$i+2 ) :	 $linkTo = SEO::generateNewsURL($news[$i]->id,$news[$i]->title);  ?>
						<div class="col-md-4 col-lg-4 divider clear-padding">
							<?php if( !empty($news[$i]->featurePhoto) ) : ?>
								<div class="col-sm-12 col-md-3 col-lg-3 clear-padding" style="padding-left:15px; padding-top:20px;"><a href="{{ $linkTo }}"><img src="<?php echo "../".$news[$i]->featurePhoto; ?>" class="img-responsive" width="82" height="82"></a></div>
								<div class="col-sm-12 col-md-9 col-lg-9 clear-padding" style="padding-left:15px;padding-right:15px;padding-top:20px;"><a href="{{ $linkTo }}" class="news-style2">{{Str::limit($news[$i]->descriptions, Options::PAGE_HOME_CATEGORY_DESC_WITH_IMG_CHAR) }}</a></div>
							<?php else : ?>
								<div class="col-sm-12 col-md-12 col-lg-12 clear-padding" style="padding-left:15px;padding-right:15px;padding-top:20px;"><a href="{{ $linkTo }}" class="news-style2">{{Str::limit($news[$i]->descriptions, Options::PAGE_HOME_CATEGORY_DESC_WITHOUT_IMG_CHAR) }}</a></div>
							<?php endif; ?>
							
							<?php if( !empty($news[$i+1] )) : $linkTo = SEO::generateNewsURL($news[$i+1]->id,$news[$i+1]->title); ?>
								<div class="clearfix"></div>
								<?php if( !empty($news[$i+1]->featurePhoto) ) : ?>
									<div class="col-sm-12 col-md-3 col-lg-3 clear-padding" style="padding-left:15px; padding-top:20px;"><a href="{{ $linkTo }}"><img src="<?php echo "../".$news[$i+1]->featurePhoto; ?>" class="img-responsive" width="82" height="82"></a></div>
									<div class="col-sm-12 col-md-9 col-lg-9 clear-padding" style="padding-left:15px;padding-right:15px;padding-top:20px;"><a href="{{ $linkTo }}" class="news-style2">{{Str::limit($news[$i+1]->descriptions, Options::PAGE_HOME_CATEGORY_DESC_WITH_IMG_CHAR) }}</a></div>
								<?php else : ?>
									<div class="col-sm-12 col-md-12 col-lg-12 clear-padding" style="padding-left:15px;padding-right:15px;padding-top:20px;"><a href="{{ $linkTo }}" class="news-style2">{{Str::limit($news[$i+1]->descriptions, Options::PAGE_HOME_CATEGORY_DESC_WITHOUT_IMG_CHAR) }}</a></div>
								<?php endif; ?>
							<?php endif; ?>
							
						</div><!-- / col-md-4-->
					<?php endfor; ?>
												
					</div><!-- / col-md-12-->
					<?php endif; ?>
				<?php endforeach; ?>
				</div><!-- / row-->
    </div> 
	<!-- /.container -->
 
    @stop
    
